home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11529 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: nntp.coast.net!torn!news!apollo!saed
  3. From: saed@engn.uwindsor.ca (Saed Aryan,13325,1100,g)
  4. Subject: Instantiate Forward Declared Class
  5. X-Nntp-Posting-Host: apollo.engn.uwindsor.ca
  6. Message-ID: <DoAu1u.Lxx@news.uwindsor.ca>
  7. Keywords: Forward declaration
  8. Sender: news@news.uwindsor.ca (Usenet)
  9. Reply-To: saed@engn.uwindsor.ca
  10. Organization: VLSI Research Group - University of Windsor
  11. Date: Fri, 15 Mar 1996 07:56:17 GMT
  12.  
  13. Hi All,
  14.  
  15. --- How do you instantiate a class that has not yet been defined but has been
  16.     forward declared?
  17.  
  18. e.g. how do you implement the following:
  19.  
  20. class A { public : AMethod(B bObj){}; };
  21. class B { public : BMethod(A aObj){}; };
  22.  
  23. compiling this will result in an error message telling that A and B are not known.
  24. But when froward declaring A and B as in "class A; class B;" before the two lines
  25. above, the error message becomes: parameters bObj and aObj are incomplete types.
  26.  
  27. Apparently it is not possible to instantiate a declared but not yet defined class.
  28.  
  29. The answer to this question will also answer my previous question (143815)
  30. From saed@engn.uwindsor.ca
  31. Subject: error: undef. but decl. template as member
  32. Date: Wed, 13 Mar 1996 02:14:38 GMT
  33.  
  34. Thanks in advance,
  35. Aryan.
  36.  
  37.  
  38.  
  39.  
  40.